import { Param } from "./types";

export const Flake8ImportConventionsParamList: Param[] = [
    {
        name: "aliases",
        descEn: "",
        descCn: "",
        defaultValue: { "altair": "alt", "matplotlib": "mpl", "matplotlib.pyplot": "plt", "numpy": "np", "pandas": "pd", "seaborn": "sns", "tensorflow": "tf", "holoviews": "hv", "panel": "pn", "plotly.express": "px", "polars": "pl", "pyarrow": "pa" },
        url: "https://beta.ruff.rs/docs/settings/#aliases",
        validValue: (value: unknown) => {
            if (typeof value !== "object") {
                return "配置值必须是一个对象";
            }
            for (const v of Object.values(value as object)) {
                if (typeof v !== "string") {
                    return "对象值必须是字符串";
                }
            }
            return null;
        },
    },
    {
        name: "banned-aliases",
        descEn: "A mapping from module to its banned import aliases.",
        descCn: "",
        defaultValue: {},
        demoValue: { "tensorflow.keras.backend": ["K"] },
        url: "https://beta.ruff.rs/docs/settings/#banned-aliases",
        validValue: (value: unknown) => {
            if (typeof value !== "object") {
                return "配置必须是对象";
            }
            for (const v of Object.values(value as object)) {
                if (!Array.isArray(v)) {
                    return "对象值必须是字符串数组";
                }
                for (const av of (v as unknown[])) {
                    if (typeof av !== "string") {
                        return "对象值必须是字符串数组";
                    }
                }
            }
            return null;
        },
    },
    {
        name: "banned-from",
        descEn: "A list of modules that are allowed to be imported from",
        descCn: "",
        defaultValue: [],
        url: "https://beta.ruff.rs/docs/settings/#banned-from",
    },
    {
        name: "extend-aliases",
        descEn: "",
        descCn: "",
        defaultValue: {},
        demoValue: { "dask.dataframe": "dd" },
        url: "https://beta.ruff.rs/docs/settings/#extend-aliases",
        validValue: (value: unknown) => {
            if (typeof value !== "object") {
                return "配置值必须是对象";
            }
            for (const v of Object.values(value as object)) {
                if (typeof v !== "string") {
                    return "对象值必须是字符串";
                }
            }
            return null;
        },
    },
];